package com.jianbing.util;

import java.util.Random;

/**
 * Created by Han, Tixiang on 2016/10/20 0020.
 */
public class RandomUtils {
    private static Random random;

    //双重校验锁获取一个Random单例
    public static Random getRandom() {
        if (random == null) {
            synchronized (RandomUtils.class) {
                if (random == null) {
                    random = new Random();
                }
            }
        }
        return random;
    }
}
